// 引入二次封装axios
import request from "@/utils/request";
import type { HospitalDetailData, DepartmentResponseData, LoginData, UserLoginResponseData, WXLoginResponseData, HopitalWordData, DoctorResponseData, UserResponseData, RegisterDoctorResponseData } from './type'
// 枚举请求地址
enum API {
    // 医院预约挂号详情
    HOSPITALDETAIL_URL = '/hosp/hospital/',
    // 获取某一医院科室的数据
    HOSPITALDEPARMENT_URL = '/hosp/hospital/department/',
    // 获取短信验证码
    GETUSERCODE_URL = '/sms/send/',
    // 用户登录接口
    USERLOGIN_URL = '/user/login/',
    // 获取微信扫码登录需要参数
    WXLOGIN_URL = '/user/weixin/getLoginParam/',
    // 获取某一医院某一科室预约挂号的数据
    HOSPITALWORK_URL = '/hosp/hospital/auth/getBookingScheduleRule/',
    // 获取医院某一个科室某一天相应医生排班的数据
    HOSPITALDOCTORWORK_URL = '/hosp/hospital/auth/findScheduleList/',
    // 获取某一账号下的就诊人信息
    GETUSER_URL = '/user/patient/auth/findAll',
    // 获取挂号医生的信息
    GETDOCTOR_URL = '/hosp/hospital/getSchedule/'

}
// 获取医院详情的接口
export const reqHospitalDetail = (hoscode: string) => {
    return request.get<any, HospitalDetailData>(API.HOSPITALDETAIL_URL + hoscode)
}

// export const reqHospitalDetail = (hoscode: string) => {
//     return request<any, HospitalDetailData>({
//         method: 'GET',
//         url: API.HOSPITALDETAIL_URL + hoscode,
//     })
// }



// 获取某一医院科室的数据
export const reqHospitalDeparment = (hoscode: string) => {
    return request.get<any, DepartmentResponseData>(API.HOSPITALDEPARMENT_URL + hoscode)
}
// 获取验证码
export const reqCode = (phone: string) => {
    return request.get<any, any>(API.GETUSERCODE_URL + phone)
}
//用户登录
export const reqUserLogin = (data: LoginData) => {
    return request.post<any, UserLoginResponseData>(API.USERLOGIN_URL, data)
}
// 获取微信扫码登录生成二维码需要得参数
export const reqWxLogin = (wxRedirectUri: string) => {
    return request.get<any, WXLoginResponseData>(API.WXLOGIN_URL + `?wxRedirectUri=${wxRedirectUri}`)
}
// 获取某一医院某一科室预约挂号的数据
export const reqHospitalWork = (page: string, limit: string, hoscode: string, depcode: string) => {
    return request.get<any, HopitalWordData>(API.HOSPITALWORK_URL + `${page}/${limit}/${hoscode}/${depcode}`)
}
// 获取医院某一个科室某一天相应医生排班的数据
export const reqHospitalDectorWork = (hoscode: string, depcode: string, workDate: string) => {
    return request.get<any, DoctorResponseData>(API.HOSPITALDOCTORWORK_URL + `${hoscode}/${depcode}/${workDate}`)
}
// 获取某一账号下的就诊人信息
export const reqGetUser = () => {
    return request.get<any, UserResponseData>(API.GETUSER_URL)
}
// 获取挂号医生的信息
export const reqDoctor = (scheduleId: string) => {
    return request.get<any, RegisterDoctorResponseData>(API.GETDOCTOR_URL + scheduleId)
}